package com.godofgamblers.hotelmanagementsystem.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @Author: 伴你时光尽头
 * @Date: 2019/10/22 14:19
 */
public class PropertiesUtil {//用于读取dbbackup.properties
    private static Properties properties = null;

    static{
        InputStream resourceAsStream = null;
        resourceAsStream = PropertiesUtil.class.getClassLoader().getResourceAsStream("dbbackup.properties");
        try {
            properties = new Properties();
            properties.load(resourceAsStream);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(resourceAsStream!=null)
                try {
                    resourceAsStream.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
        }
    }

    public static  Properties getProperties(){
        if(properties!=null){
            return properties;
        }
        return null;
    }
}
